find duplicate characters from string in java and count characters in string